package com.wyw.hemerocallis.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * 类/方法简述
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * <p>
 * Update History:
 * Author        Time            Content
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "hemerocallis_path")
public class HemerocallisPath {
    /** 主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private int id;

    /** 路径模式 */
    @Basic
    @Column(name = "path_pattern", nullable = false)
    private String pathPattern;

    /** HTTP 方法类型 */
    @Basic
    @Column(name = "http_method", nullable = false)
    private String httpMethod;

    /** 路径名称 */
    @Basic
    @Column(name = "path_name", nullable = false)
    private String pathName;

    /** 服务名称 */
    @Basic
    @Column(name = "service_name", nullable = false)
    private String serviceName;

    /** 操作模式: READ, WRITE */
    @Basic
    @Column(name = "op_mode", nullable = false)
    private String opMode;

    /**
     * 不带主键的构造函数
     * */
    public HemerocallisPath(String pathPattern, String httpMethod, String pathName,
                String serviceName, String opMode) {

        this.pathPattern = pathPattern;
        this.httpMethod = httpMethod;
        this.pathName = pathName;
        this.serviceName = serviceName;
        this.opMode = opMode;
    }

}
